import { defineStore } from "pinia";
import { ref } from "vue";

export const useViewHeightStore = defineStore("viewheight", () => {
  const viewheight = ref<number>();
  
  const GetViewHeight = (boxheight:number)=>{
    return (viewheight.value - boxheight); 
  }

(() => {
   // 获取初始视口高度
   viewheight.value = window.innerHeight;
   // 监听窗口大小改变事件
   window.addEventListener('resize', () => {
       // 更新视口高度
       viewheight.value = window.innerHeight;
   })
})()

  return { GetViewHeight }
});
